import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import '../../../../../../lib_baseview/theme/jr.dart';
import '../../../../../../lib_baseview/utils/constant/text_styles.dart';
import '../../../../../../resource/language/generated/l10n.dart';
// import 'package:lib_basemodel/server_client/ranking_list.pb.dart';
// import 'package:lib_baseview/lib_baseview.dart';
// import 'package:lib_im/lib_im.dart';
// import 'package:lib_runtime/lib_runtime.dart';
// import 'package:m_chatroom/m_chatroom.dart';
// import 'package:m_chatroom/src/template/user_list/rank/widget/true_lova_avatar_widget.dart';
// import 'package:lib_basemodel/lib_basemodel.dart';

class TrueLoveItemWidget extends StatelessWidget {
  // final TrueLoveRankListItem item;
  final bool inRoom;

  const TrueLoveItemWidget({
    super.key,
    // required this.item,
    this.inRoom = false,
  });

  @override
  Widget build(BuildContext context) {
    return Material(
      type: MaterialType.transparency,
      child: InkWell(
        onTap: () {
          // if (item.hasChannelId()) {
          //   RoomPage.show(context, item.channelId.toInt());
          // }
        },
        child: Container(
          height: 80.h,
          alignment: Alignment.center,
          padding: EdgeInsets.symmetric(horizontal: 16.w),
          child: Row(
            mainAxisSize: MainAxisSize.max,
            children: [
              // TrueLoveAvatarWidget(
              //   sender: item.sender,
              //   receiver: item.receiver,
              //   inRoom: inRoom,
              // ),
              SizedBox(width: 10.w),
              Expanded(
                child: Column(
                  mainAxisSize: MainAxisSize.min,
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Row(mainAxisSize: MainAxisSize.max, children: [
                      Flexible(
                        child: Text('nickname',
                            maxLines: 1,
                            overflow: TextOverflow.ellipsis,
                            style: JRTextStyles.styleFont14W600
                                .copyWith(color: JR.color.mainText)),
                      ),
                      const Text('UserLevWidget'),
                      const Text('UserCarLevelWidget'),
                      const Text('UserKnightWidget'),
                      // UserLevWidget(vipImgStr: item.sender.vipLevelIcon),
                      // UserCarLevelWidget(
                      //   carLevel: item.sender.car.carMetaInfo.level,
                      //   job: item.sender.job,
                      // ),
                      // UserKnightWidget(
                      //   imgStr: item.sender.knightIcon,
                      // )
                    ]),
                    SizedBox(height: 5.h),
                    Row(
                      mainAxisSize: MainAxisSize.min,
                      children: [
                        Text(T.current!.package,
                            style: JRTextStyles.styleFont12W400
                                .copyWith(color: JR.color.secondaryText)),
                        Flexible(
                            child: Text('nickname',
                                maxLines: 1,
                                overflow: TextOverflow.ellipsis,
                                style: JRTextStyles.styleFont12W400
                                    .copyWith(color: JR.color.mainText)))
                      ],
                    ),
                    // if (item.hasChannelId() && item.channelName.isEmpty)
                    //   const SizedBox.shrink()
                    // else
                    //   Padding(
                    //     padding: EdgeInsets.only(top: 5.h),
                    //     child: Row(
                    //       mainAxisSize: MainAxisSize.min,
                    //       children: [
                    //         if (item.hasChannelId())
                    //           image('ic_room.svg',
                    //               width: 12.w, fit: BoxFit.fitWidth)
                    //         else
                    //           image('ic_coin.png', width: 12, height: 12),
                    //         SizedBox(width: 4.w),
                    //         if (item.hasChannelId())
                    //           Flexible(
                    //               child: Text(item.channelName,
                    //                   maxLines: 1,
                    //                   overflow: TextOverflow.ellipsis,
                    //                   style: JRTextStyles.styleFont10W400
                    //                       .copyWith(
                    //                           color: JR.color.secondaryText)))
                    //         else
                    //           Flexible(
                    //               child: Text(item.coin.toString(),
                    //                   maxLines: 1,
                    //                   overflow: TextOverflow.ellipsis,
                    //                   style: JRTextStyles.styleFont12W500
                    //                       .copyWith(
                    //                           color: JR.color.mainBrand,
                    //                           fontWeight: FontWeight.w600)))
                    //       ],
                    //     ),
                    //   ),
                  ],
                ),
              ),
              SizedBox(width: 10.w),
              // Column(
              //   mainAxisSize: MainAxisSize.min,
              //   children: [
              //     image(StringUtil.formatImgUrl(item.itemInfo.icon, size: 150),
              //         width: 48, height: 48, fit: BoxFit.contain),
              //     SizedBox(height: 4.h),
              //     Text(_sendTimeText,
              //         style: JRTextStyles.styleFont10W400
              //             .copyWith(color: JR.color.secondaryText)),
              //   ],
              // )
            ],
          ),
        ),
      ),
    );
  }

  String get _sendTimeText {
    // return timeAgo.getDateDiff(item.createTime.toInt());
    return 'timeAgo.getDateDiff';
  }
}
